#ifndef H_CBASE
#define H_CBASE

#include "IBaseInterface.h"

#include <windows.h>

enum ObjectTypes{OBJ_BASE, OBJ_PLAYER,OBJ_ENEMY, OBJ_EXPORB, OBJ_CRACK, OBJ_INVERSE, OBJ_GAUNTLET, OBJ_SAVEPOINT, OBJ_BOLT, OBJ_MAX};


#define PLAY_WIDTH_LEFT 31
#define PLAY_WIDTH_RIGHT 432
#define PLAY_HEIGHT_TOP 51
#define PLAY_HEIGHT_BOTTOM 480

class CBase : public IBaseInterface
{
private:

	unsigned int m_uiRefCount;

	float m_fPosX;
	float m_fPosY;

	float m_fVelX;
	float m_fVelY;

	float m_fOffestX;
	float m_fOffestY;

	int m_nImageID;

	int m_nWidth;
	int m_nHeight;
	bool m_bIsActive;
	bool facing_right;

	float m_fScaleX;
	float m_fScaleY;


protected:

	int m_nType;

public:
	CBase(void);
	virtual ~CBase(void);

	float GetPosX(void) { return m_fPosX; };
	float GetPosY(void) { return m_fPosY; };

	float GetVelX(void) { return m_fVelX; };
	float GetVelY(void) { return m_fVelY; };

	int GetImageID(void) { return m_nImageID; };


	void SetPosX(float fPosX) { m_fPosX = fPosX; };
	void SetPosY(float fPosY) { m_fPosY = fPosY; };

	void SetVelX(float fVelX) { m_fVelX = fVelX; };
	void SetVelY(float fVelY) { m_fVelY = fVelY; };

	void SetImageID(int nImageID) { m_nImageID = nImageID; };

	int GetWidth(void) { return m_nWidth; };
	void SetWidth(int nWidth) { m_nWidth = nWidth; };

	int GetHeight(void) { return m_nHeight; };
	void SetHeight(int nHeight) { m_nHeight = nHeight; };

	bool GetIsActive(void) { return m_bIsActive; };
	void SetIsActive(bool bIsActive) { m_bIsActive = bIsActive; };

	void SetFacingRight(bool facing){ facing_right = facing; }
	bool GetFacingRight() { return facing_right; }
	
	int GetType(void) { return m_nType; };

	float GetScaleX(){return m_fScaleX; }
	float GetScaleY(){return m_fScaleY; }

	void SetOffestX(float offsetx){m_fOffestX = offsetx;}
	void SetOffestY(float offsety){m_fOffestY = offsety;}

	void SetScaleX(float fScaleX){m_fScaleX = fScaleX;}
	void SetScaleY(float fScaleY){m_fScaleX = fScaleY;}


	virtual RECT GetCollisionRect(void);
	virtual bool CheckCollision(CBase* pBase);
	RECT GetLevelCollisionRect(void);

	virtual void Update(float fElapsedTime);
	virtual void Render(void);

	void AddRef(void)
	{
		++m_uiRefCount;
	}

	void Release(void)
	{
		--m_uiRefCount;

		if(m_uiRefCount == 0)
			delete this;
	}
};

#endif